package com.example.leetcode.tree;

import com.example.leetcode.tree.common.TreeNode;
import com.example.leetcode.tree.common.TreeUtils;

import java.util.Arrays;
import java.util.List;

/**
 * AC
 */
class Solution100 {
    public boolean isSameTree(TreeNode p, TreeNode q) {
        return TreeUtils.compareTwoTreeByBFSTraverse(p, q);
    }
}

/**
 * 100. 相同的树
 */
public class leetcode100 {

    public static void main(String[] args) {

        // 生成第一棵树
        System.out.println("第一棵树");
        Integer[] arrP = {1, 2};
        List<Integer> nodeListP = Arrays.asList(arrP);
        TreeNode p = TreeUtils.generateAtreeByBFSList(nodeListP);

        // 生成第二棵树
        System.out.println("第二棵树");
        Integer[] arrQ = {1, null, 2};
        List<Integer> nodeListQ = Arrays.asList(arrQ);
        TreeNode q = TreeUtils.generateAtreeByBFSList(nodeListQ);

        Solution100 solution100 = new Solution100();

        boolean sameTree = solution100.isSameTree(p, q);

        System.out.println("比较结果");
        System.out.println(sameTree);

    }


}
